package com.xxl.job.core.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * 数据链接归属
 */
public enum DbinfoBelongEnum {
    SHARED("shared","数据共享"),
    SHARED_MONGODB("shared_mongodb","数据共享MongoDB"),
    IRSPBDS("irspbds","数据汇聚"),
    PEOPLE("people","人口库"),
    COMPANY("company","法人库");
    private String key;
    private String remark;

    private DbinfoBelongEnum(String key, String remark) {
        this.key = key;
        this.remark = remark;
    }

    public String getKey() {
        return key;
    }

    public String getRemark() {
        return remark;
    }

    /**
     * 获取所有枚举，用于页面下拉列表
     * @return
     */
    public static Map<String,String> getMap() {
        Map<String, String> map = new HashMap<>();

        DbinfoBelongEnum[] belongEnums = DbinfoBelongEnum.values();
        if(belongEnums.length == 0) return map;
        for (DbinfoBelongEnum belongEnum : belongEnums) {
            map.put(belongEnum.getKey(), belongEnum.getRemark());
        }
        return map;
    }
}
